from framwork.common.tools  import open_browsers
from time import sleep
from selenium.webdriver.common.by import By


"""返回线索  ok"""
#数据
url=r"http://192.168.1.36/crm/index.php?m=user&a=login"
user_name="admin"
passwd="123456"
#定位器
user_locator=(By.CSS_SELECTOR,"body > div.container > div > div.span4 > div > form > fieldset > input:nth-child(2)")
password_locator=(By.CSS_SELECTOR,"body > div.container > div > div.span4 > div > form > fieldset > input:nth-child(4)")
btn1_locator=(By.CSS_SELECTOR,"body > div.container > div > div.span4 > div > form > fieldset > input.btn.btn-primary")
clue_locator=(By.LINK_TEXT,"线索")
see_locator=(By.LINK_TEXT,"查看")
return_locator=(By.LINK_TEXT,"返回")
#操作
driver=open_browsers()
driver.get(url)
sleep(3)
driver.find_element(*user_locator).send_keys(user_name)
driver.find_element(*password_locator).send_keys(passwd)
driver.find_element(*btn1_locator).click()
sleep(3)
driver.find_element(*clue_locator).click()
driver.find_element(*see_locator).click()
driver.find_element(*return_locator).click()
#退出浏览器
sleep(3)
driver.close()